import java.util.Arrays;

public class ConcreteWeatherSubject extends WeatherSubject {

	//"晴天"，"下雨","下雪"
	private String weatherContent;
	@Override
	protected void notifyObservers() {
		for(Observer observer:observers) {
			//规则：
			//黄明的女朋友 需要 “下雨”的条件通知
			//黄明的老妈需要“下雨”或者“下雪”
			if("下雨".equals(this.getWeatherContent())) {
				if(Arrays.asList("黄明的女朋友","黄明的老妈").contains(observer.getObserverName())) {
					observer.update(this);
				}
			}
			if("下雪".equals(this.getWeatherContent())) {
				if(("黄明的老妈").equals(observer.getObserverName())){
					observer.update(this);
				}
			}
		}
	}
	public String getWeatherContent() {
		return weatherContent;
	}
	public void setWeatherContent(String weatherContent) {
		this.weatherContent = weatherContent;
		this.notifyObservers();
	}

}
